import context from '../main.js'
const state = {
	isSubscribed:true,//默认未订阅消息
    tmplIds : ['vckEfCcGffEwnUJZwwTxz7sk4oEHiUdL7Hcv8dwDWEU','2ghWxnwiCAmmtPhhbQt2-el9DSNATYBKrlVE_fc2JBQ'],
}
const mutations = {
    setSubscribed(state,data){
        state.isSubscribed = data;
		//console.log('state.isSubscribed->',state.isSubscribed)
    },
}
const actions = {
    setSubscribeStatus({commit},payload) {
		// console.log(context.$store)
		context.$api.getUserIsSub({
			userName:context.$store.state.user.userInfo.nickName
		}).then(res => {
			if(!res){
				commit("setSubscribed",false);
				return
			}
			commit("setSubscribed",res.data.code);
		})
        
    },
};
export  default {
	namespaced: true,
    state,
	mutations,
	actions
}